# // ***************************************************************************
# // 
# // Copyright (c) Scriptimus Ex Machina.  All rights reserved.
# // 
# // Microsoft Deployment Toolkit Support Script
# //
# // File:      ZTIEnableAdminAccount.ps1
# // 
# // Version:   1.00 
# // 
# // Purpose:   Enables the local administrator account
# // 
# // ***************************************************************************

<#
.Synopsis
   Enable Local Administrator User Account
.DESCRIPTION
   This script will Enable the Local Administrator User Account if it is disabled
.EXAMPLE
ZTIEnableLocalAdminAccount.ps1

.NOTES
   Author: Andrew Barnes
   Version: 1.0
   Created: 11 December 2012
   Last updated: 11 December 2012
   Website: http:\\scriptimus.wordpress.com

#>

    Begin {

        Write-Host "Begining script"

        $EnableUser = 512
    
        $DisableUser = 2
    
        [ADSI]$Admin="WinNT://$Env:COMPUTERNAME/Administrator,user"

        }
    
    Process{

        Write-Host "Processing Script"
    
        # Enable Local Admin account
    
        If ($Admin.Disabled) { 
    
            Write-Host "Enabling Administrator account." 
    
            $Admin.userflags = $EnableUser
    
            $Admin.setinfo()
    
            }
        }
    
    End {
    
        Write-Host "End Script"
    
        }
